﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ChucNang_KhachHangThanThiet_KHTT_LoaiKhoiDanhSach : System.Web.UI.Page
{
    string page;
    GlobalFunctions gf;
    string url;
    protected void Page_Load(object sender, EventArgs e)
    {
        string sid = Request.QueryString.Get("Id");
        page= Request.QueryString.Get("page");
        gf=new GlobalFunctions();
        url= Request.QueryString.Get("url");
       if (sid == null || (gf.IsKHTT()==0 && gf.IsKHDC() == 0))
            Response.Redirect("../NguoiDung/NguoiDung_XemDanhSachSanPham.aspx");
        else
        {
            DataDSTableAdapters.SANPHAMYEUTHICHTableAdapter spytadapter = new DataDSTableAdapters.SANPHAMYEUTHICHTableAdapter();
            int? kq = 0;
            spytadapter.SANPHAMYEUTHICH_XoaTheoMaSanPham(gf.getCMND().Trim(), sid, ref kq);
            if (kq == 0)
            {
                Label1.Text = "Loại Thành Công!";
                Panel1.Visible = true;
            }
            else
            {
                Label1.Text = "Loại Không Thành Công!";
                Panel1.Visible = true;
            }
          //  else

        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (page == null)
            page = "0";
        if (url == null)
            Response.Redirect("../NguoiDung/NguoiDung_XemDanhSachSanPham.aspx?page=" + page);
        else
            Response.Redirect(url);
    }
}
